/*
 * @LastEditors: yuSeen
 * @LastEditTime: 2021-12-17 23:13:37
 * 天凉好个秋
 */
import { useSettingStore } from "@/store/setting";

export const useThemeSetting = () => {
  const settingStore = useSettingStore();
  const htmlRoot = document.getElementById("htmlRoot") as HTMLElement;

  // 获取当前主题
  const getThemeColor = () => {
    return settingStore.theme
  }
  //   设置主题
  const setThemeColor = (color: string) => {
    htmlRoot.style.setProperty("--theme-color", color);
    settingStore.setTheme(color);
  };

  return {
    getThemeColor,
    setThemeColor
  };
};
